package com.easyboot.framework.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author yushuo
 * @className
 * @descripton TODO
 * @date 2021/2/3 13:57
 **/
@Component
@ConfigurationProperties(prefix = "easycms")
public class EasyBootConfig {
    /** 项目名称 */
    private String name;

    /** 版本 */
    private String version;

    /** 版权年份 */
    private String copyrightYear;

    /** 实例演示开关 */
    private boolean demoEnabled;

    /** 上传路径 */
    private  String resourceDir;

    /** 获取地址开关 */
    private  boolean addressEnabled;
    private static String getRootResourceDir;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCopyrightYear() {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear) {
        this.copyrightYear = copyrightYear;
    }

    public boolean isDemoEnabled() {
        return demoEnabled;
    }

    public void setDemoEnabled(boolean demoEnabled) {
        this.demoEnabled = demoEnabled;
    }

    public  String getResourceDir() {
        return resourceDir;
    }

    public void setResourceDir(String resourceDir) {
        EasyBootConfig.getRootResourceDir=resourceDir;
        this.resourceDir = resourceDir;
    }

    public  boolean isAddressEnabled() {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled) {
        this.addressEnabled = addressEnabled;
    }

    /**
     * 获取头像上传路径
     */
    public  String getAvatarPath() {
        return getResourceDir() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public  String getDownloadPath() {
        return getResourceDir() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public  String getUploadPath() {
        return getResourceDir() + "/upload";
    }
    public static String getRootResourceDir() {return EasyBootConfig.getRootResourceDir;}
}
